home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Burning & Media / GB-PVR 1.2.13 / GBPVR10213.msi / Cabs.w1.cab / RichTextBulletedList.cs85 < prev    next >
Text File  |  2007-01-06  |  1KB  |  36 lines

  1. using System;
  2. using System.IO;
  3. using System.Text;
  4. using System.Text.RegularExpressions;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7.  
  8. //Code found at: http://dotnetslackers.com/articles/aspnet/A_Better_BulletedList.aspx
  9. //Author: Todd Northrop : http://blogs.lotterypost.com/todd/
  10.  
  11. namespace gbweb
  12. {
  13.  
  14.     public class RichTextBulletedList : BulletedList
  15.     {
  16.         protected override void Render(System.Web.UI.HtmlTextWriter writer)
  17.         {
  18.             StringBuilder sb = new StringBuilder();
  19.             StringWriter sw = new StringWriter(sb);
  20.             HtmlTextWriter htmlWriter = new HtmlTextWriter(sw);
  21.             String rendered;
  22.  
  23.             base.Render(htmlWriter);
  24.             rendered = Regex.Replace(sb.ToString(), "(?<!<)<(?!<)", "<");
  25.             rendered = Regex.Replace(rendered, "(?<!>)>(?!>)", ">");
  26.             rendered = Regex.Replace(rendered, "(?<!")"(?!")", "\"");
  27.  
  28.             rendered = rendered.Replace("<<", "<")
  29.                 .Replace(">>", ">")
  30.                 .Replace("""", """);
  31.  
  32.             writer.Write(rendered);
  33.         }
  34.     }
  35. }
  36.